"use strict"

/**
 * 沧州市政府采购网爬虫
 *  
 */

var Base = require("./base");
var cz_spider = new Base();
cz_spider.name = "沧州市政府采购网";
cz_spider.encode = "GBK";

cz_spider.getPageUrl = function (pg) {
    var url = "http://www.cangzhou.gov.cn/zwbz/zfcg/qbgg/index_" + (pg - 1) + ".shtml";
    if (pg == 1) {
        url = "http://www.cangzhou.gov.cn/zwbz/zfcg/qbgg/index.shtml";
    };
    return url;
};

cz_spider.getItems = function ($) {
    var items = [];
    $(".zw_xxlb ul li a").each(function (index, ele) {
        var e = $(ele);
        var item = {};
        item.title = e.attr("title");
        item.url = "http://www.cangzhou.gov.cn" + e.attr("href").substring(8);
        item.source = cz_spider.name;
        items.push(item);
    });
    return items;
};

exports = module.exports = cz_spider;